home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Balloons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  9.6 KB  |  238 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __BALLOONS__
  18. #define __BALLOONS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <QuickdrawText.h>                                    */
  31.  
  32. #ifndef __MENUS__
  33. #include <Menus.h>
  34. #endif
  35. /*    #include <Memory.h>                                            */
  36.  
  37. #ifndef __TEXTEDIT__
  38. #include <TextEdit.h>
  39. #endif
  40.  
  41. #ifndef __ERRORS__
  42. #include <Errors.h>
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if GENERATINGPOWERPC
  50. #pragma options align=mac68k
  51. #endif
  52.  
  53. #ifdef __CFM68K__
  54. #pragma lib_export on
  55. #endif
  56.  
  57.  
  58. enum {
  59.     hmBalloonHelpVersion        = 0x0002,                        /* The real version of the Help Manager */
  60.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  61.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help… */
  62.     kHMShowBalloonsItem            = 3,                            /* help menu item number of Show/Hide Balloons */
  63.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  64.     kBalloonWDEFID                = 126,                            /* Resource ID of the WDEF proc used in standard balloons */
  65. /* Dialog item template type constant */
  66.     helpItem                    = 1,                            /* key value in DITL template that corresponds to the help item */
  67. /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  68.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  69.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  70.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  71. };
  72.  
  73. enum {
  74.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  75.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  76.     hmMatchInTitle                = 16,                            /* for hwin resources, match string anywhere in window title string */
  77. /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  78.     kHMStringItem                = 1,                            /* pstring used in resource */
  79.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  80.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  81.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  82.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  83.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  84.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  85.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  86.     kHMTrackCntlItem            = 2048,                            /* Reserved */
  87. /* Constants for hmmHelpType's when filling out HMMessageRecord */
  88.     khmmString                    = 1,                            /* help message contains a PString */
  89.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  90.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  91.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  92.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  93.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  94.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  95.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  96. };
  97.  
  98. enum {
  99. /* ResTypes for Styled TE Handles in Resources */
  100.     kHMTETextResType            = 'TEXT',                        /* Resource Type of text data for styled TE record w/o style info */
  101.     kHMTEStyleResType            = 'styl'
  102. };
  103.  
  104. enum {
  105.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  106.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  107.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  108. /* Method parameters to pass to HMShowBalloon */
  109.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  110.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  111.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  112. };
  113.  
  114. enum {
  115. /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  116.     kHMMenuResType                = 'hmnu',                        /* ResType of help resource for supporting menus */
  117.     kHMDialogResType            = 'hdlg',                        /* ResType of help resource for supporting dialogs */
  118.     kHMWindListResType            = 'hwin',                        /* ResType of help resource for supporting windows */
  119.     kHMRectListResType            = 'hrct',                        /* ResType of help resource for rectangles in windows */
  120.     kHMOverrideResType            = 'hovr',                        /* ResType of help resource for overriding system balloons */
  121.     kHMFinderApplResType        = 'hfdr'
  122. };
  123.  
  124. struct HMStringResType {
  125.     short                            hmmResID;
  126.     short                            hmmIndex;
  127. };
  128. typedef struct HMStringResType HMStringResType;
  129.  
  130. struct HMMessageRecord {
  131.     SInt16                            hmmHelpType;
  132.     union {
  133.         Str255                            hmmString;
  134.         SInt16                            hmmPict;
  135.         TEHandle                        hmmTEHandle;
  136.         HMStringResType                    hmmStringRes;
  137.         SInt16                            hmmPictRes;
  138.         PicHandle                        hmmPictHandle;
  139.         SInt16                            hmmTERes;
  140.         SInt16                            hmmSTRRes;
  141.     } u;
  142. };
  143.  
  144. typedef struct HMMessageRecord HMMessageRecord;
  145.  
  146. typedef HMMessageRecord *HMMessageRecPtr;
  147.  
  148. typedef pascal OSErr (*TipFunctionProcPtr)(Point tip, RgnHandle structure, Rect *r, short *balloonVariant);
  149.  
  150. #if GENERATINGCFM
  151. typedef UniversalProcPtr TipFunctionUPP;
  152. #else
  153. typedef TipFunctionProcPtr TipFunctionUPP;
  154. #endif
  155.  
  156. enum {
  157.     uppTipFunctionProcInfo = kPascalStackBased
  158.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  159.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Point)))
  160.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(RgnHandle)))
  161.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
  162.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short*)))
  163. };
  164.  
  165. #if GENERATINGCFM
  166. #define NewTipFunctionProc(userRoutine)        \
  167.         (TipFunctionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  168. #else
  169. #define NewTipFunctionProc(userRoutine)        \
  170.         ((TipFunctionUPP) (userRoutine))
  171. #endif
  172.  
  173. #if GENERATINGCFM
  174. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  175.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  176. #else
  177. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  178.         (*(userRoutine))((tip), (structure), (r), (balloonVariant))
  179. #endif
  180.  
  181. /*  Public Interfaces  */
  182. extern pascal OSErr HMGetHelpMenuHandle(MenuHandle *mh)
  183.  THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  184. extern pascal OSErr HMShowBalloon(const HMMessageRecord *aHelpMsg, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, SInt16 balloonVariant, SInt16 method)
  185.  THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  186. extern pascal OSErr HMRemoveBalloon(void)
  187.  THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  188. extern pascal Boolean HMGetBalloons(void)
  189.  THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  190. extern pascal OSErr HMSetBalloons(Boolean flag)
  191.  THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  192. extern pascal OSErr HMShowMenuBalloon(SInt16 itemNum, SInt16 itemMenuID, SInt32 itemFlags, SInt32 itemReserved, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, SInt16 balloonVariant)
  193.  THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  194. extern pascal OSErr HMGetIndHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, UInt32 *options, Point *tip, Rect *altRect, SInt16 *theProc, SInt16 *balloonVariant, HMMessageRecord *aHelpMsg, SInt16 *count)
  195.  THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  196. extern pascal Boolean HMIsBalloon(void)
  197.  THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  198. extern pascal OSErr HMSetFont(SInt16 font)
  199.  THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  200. extern pascal OSErr HMSetFontSize(UInt16 fontSize)
  201.  THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  202. extern pascal OSErr HMGetFont(SInt16 *font)
  203.  THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  204. extern pascal OSErr HMGetFontSize(UInt16 *fontSize)
  205.  THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  206. extern pascal OSErr HMSetDialogResID(SInt16 resID)
  207.  THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  208. extern pascal OSErr HMSetMenuResID(SInt16 menuID, SInt16 resID)
  209.  THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  210. extern pascal OSErr HMBalloonRect(const HMMessageRecord *aHelpMsg, Rect *coolRect)
  211.  THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  212. extern pascal OSErr HMBalloonPict(const HMMessageRecord *aHelpMsg, PicHandle *coolPict)
  213.  THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  214. extern pascal OSErr HMScanTemplateItems(SInt16 whichID, SInt16 whichResFile, ResType whichType)
  215.  THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  216. extern pascal OSErr HMExtractHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, HMMessageRecord *aHelpMsg)
  217.  THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  218. extern pascal OSErr HMGetDialogResID(SInt16 *resID)
  219.  THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  220. extern pascal OSErr HMGetMenuResID(SInt16 menuID, SInt16 *resID)
  221.  THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  222. extern pascal OSErr HMGetBalloonWindow(WindowRef *window)
  223.  THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  224.  
  225. #ifdef __CFM68K__
  226. #pragma lib_export off
  227. #endif
  228.  
  229. #if GENERATINGPOWERPC
  230. #pragma options align=reset
  231. #endif
  232.  
  233. #ifdef __cplusplus
  234. }
  235. #endif
  236.  
  237. #endif /* __BALLOONS__ */
  238.